
export function initCommonTheme(){
    let _layout = localStorage.getItem('v-layout-content') || 'container-xxl';
    let el = document.getElementsByClassName('layout-navbar');
    if (el.length > 0) {
      el = el[0];
      let _classStr = el.getAttribute('class');
      _classStr = _classStr.replace('container-xxl', '');
      _classStr = _classStr.replace('container-fluid', '');
      el.setAttribute('class', _classStr + ' ' + _layout)
    }

    el = document.getElementsByClassName('content-wrapper');
    if (el.length > 0) {
      el = el[0];
      if (el.children.length > 0) {
        el = el.children[0];
        let _classStr = el.getAttribute('class');
        _classStr = _classStr.replace('container-xxl', '');
        _classStr = _classStr.replace('container-fluid', '');
        el.setAttribute('class', _classStr + ' ' + _layout)
      }
    }

    el = document.getElementsByClassName('content-footer');
    if (el.length > 0) {
      el = el[0];
      if (el.children.length > 0) {
        el = el.children[0];
        let _classStr = el.getAttribute('class');
        _classStr = _classStr.replace('container-xxl', '');
        _classStr = _classStr.replace('container-fluid', '');
        el.setAttribute('class', _classStr + ' ' + _layout)
      }
    }
}

export function setCommonTheme(_contentType){
    let el = document.getElementsByClassName('layout-navbar');
      if(el.length>0){
        el=el[0];
        let _classStr = el.getAttribute('class');
        _classStr = _classStr.replace('container-xxl', '');
        _classStr = _classStr.replace('container-fluid', '');
        el.setAttribute('class', _classStr + ' ' + _contentType)
      }

      el = document.getElementsByClassName('content-wrapper');
      if(el.length>0){
        el=el[0];
        if(el.children.length>0){
          el=el.children[0];
          let _classStr = el.getAttribute('class');
          _classStr = _classStr.replace('container-xxl', '');
          _classStr = _classStr.replace('container-fluid', '');
          el.setAttribute('class', _classStr + ' ' + _contentType)
        }
      }

      el = document.getElementsByClassName('content-footer');
      if(el.length>0){
        el=el[0];
        if(el.children.length>0){
          el=el.children[0];
          let _classStr = el.getAttribute('class');
          _classStr = _classStr.replace('container-xxl', '');
          _classStr = _classStr.replace('container-fluid', '');
          el.setAttribute('class', _classStr + ' ' + _contentType)
        }
      }

      localStorage.setItem('v-layout-content', _contentType);
}

export default{
    cuscommon:{initCommonTheme,setCommonTheme}
}
